/**********************************************************************************************/
// dgt_Algorithm.cpp
//
// 
// Copyright Diamant Group 2007
/**********************************************************************************************/

#include "DStudio.h"
#include "dgt_Algorithm.h"
#include "dgt_Log.h"

/**********************************************************************************************/
dgt_Algorithm::dgt_Algorithm(	wxString			inName,
								dgt_AlgActArray		inActions,
								dgt_AlgCondArray	inConditions,
								dgt_AlgLogArray		inLogics,
								dgt_AlgVarArray		inInputVars,
								dgt_AlgVarArray		inInternalVars,
								dgt_AlgVarArray		inOutputVars )
{
	START( "DgtKernel", "dgt_Algorithm::dgt_Algorithm" );
	LOG_PARAM( inName );
	LOG_PARAM( inActions );
	LOG_PARAM( inConditions );
	LOG_PARAM( inLogics );
	LOG_PARAM( inInputVars );
	LOG_PARAM( inInternalVars );
	LOG_PARAM( inOutputVars );

	m_Name = inName;
	for( unsigned i = 0; i < inActions.Count(); i++ )
	{
		dgt_AlgAction_Ptr tItem = inActions.Item( i );
		m_Actions.Add( tItem );
	}

	for( unsigned i = 0; i < inConditions.Count(); i++ )
	{
		dgt_AlgCondition_Ptr tItem = inConditions.Item( i );
		m_Conditions.Add( tItem );
	}

	for( unsigned i = 0; i < inLogics.Count(); i++ )
	{
		dgt_AlgLogic_Ptr tItem = inLogics.Item( i );
		m_Logics.Add( tItem );
	}

	for( unsigned i = 0; i < inInputVars.Count(); i++ )
	{
		dgt_AlgVar_Ptr tItem = inInputVars.Item( i );
		m_InputVars.Add( tItem );
	}

	for( unsigned i = 0; i < inInternalVars.Count(); i++ )
	{
		dgt_AlgVar_Ptr tItem = inInternalVars.Item( i );
		m_InternalVars.Add( tItem );
	}

	for( unsigned i = 0; i < inOutputVars.Count(); i++ )
	{
		dgt_AlgVar_Ptr tItem = inOutputVars.Item( i );
		m_OutputVars.Add( tItem );
	}

	RETURN_VOID( "dgt_Algorithm::dgt_Algorithm" );
}

/**********************************************************************************************/
wxString dgt_Algorithm::get_Name( void )
{
	START( "DgtKernel", "dgt_Algorithm::get_Name" );

	wxString result;

	result = m_Name;

	RETURN( "dgt_Algorithm::get_Name", result );
	return result;
}

/**********************************************************************************************/
void dgt_Algorithm::set_Name( wxString inName )
{
	START( "DgtKernel", "dgt_Algorithm::set_Name" );
	LOG_PARAM( inName );

	m_Name = inName;

	RETURN_VOID( "dgt_Algorithm::set_Name" );
}

/**********************************************************************************************/
dgt_AlgActArray dgt_Algorithm::get_Actions( void )
{
	START( "DgtKernel", "dgt_Algorithm::get_Actions" );

	dgt_AlgActArray result;

	for( unsigned i = 0; i < m_Actions.Count(); i++ )
		result.Add( m_Actions.Item( i ) );

	RETURN( "dgt_Algorithm::get_Name", result );
	return result;
}

/**********************************************************************************************/
void dgt_Algorithm::set_Actions( dgt_AlgActArray inActions )
{
	START( "DgtKernel", "dgt_Algorithm::set_Actions" );
	LOG_PARAM( inActions );

	for( unsigned i = 0; i < inActions.Count(); i++ )
	{
		dgt_AlgAction_Ptr tItem = inActions.Item( i );
		m_Actions.Add( tItem );
	}

	RETURN_VOID( "dgt_Algorithm::set_Actions" );
}

/**********************************************************************************************/
unsigned dgt_Algorithm::get_ActionsCount( void )
{
	START( "DgtKernel", "dgt_Algorithm::get_ActionsCount" );

	unsigned result;

	result = m_Actions.Count();

	RETURN( "dgt_Algorithm::get_Name", result );
	return result;
}

/**********************************************************************************************/
dgt_AlgCondArray dgt_Algorithm::get_Conditions( void )
{
	START( "DgtKernel", "dgt_Algorithm::get_Conditions" );

	dgt_AlgCondArray result;

	for( unsigned i = 0; i < m_Conditions.Count(); i++ )
		result.Add( m_Conditions.Item( i ) );

	RETURN( "dgt_Algorithm::get_Name", result );
	return result;
}

/**********************************************************************************************/
void dgt_Algorithm::set_Conditions( dgt_AlgCondArray inConditions )
{
	START( "DgtKernel", "dgt_Algorithm::set_Conditions" );
	LOG_PARAM( inConditions );

	for( unsigned i = 0; i < inConditions.Count(); i++ )
	{
		dgt_AlgCondition_Ptr tItem = inConditions.Item( i );
		m_Conditions.Add( tItem );
	}

	RETURN_VOID( "dgt_Algorithm::set_Conditions" );
}

/**********************************************************************************************/
unsigned dgt_Algorithm::get_ConditionsCount( void )
{
	START( "DgtKernel", "dgt_Algorithm::get_ConditionsCount" );

	unsigned result;

	result = m_Conditions.Count();

	RETURN( "dgt_Algorithm::get_Name", result );
	return result;
}

/**********************************************************************************************/
dgt_AlgLogArray	dgt_Algorithm::get_Logics( void )
{
	START( "DgtKernel", "dgt_Algorithm::get_Logics" );

	dgt_AlgLogArray result;

	for( unsigned i = 0; i < m_Logics.Count(); i++ )
		result.Add( m_Logics.Item( i ) );

	RETURN( "dgt_Algorithm::get_Name", result );
	return result;
}

/**********************************************************************************************/
void dgt_Algorithm::set_Logics( dgt_AlgLogArray inLogic )
{
	START( "DgtKernel", "dgt_Algorithm::set_Logics" );
	LOG_PARAM( inLogic );

	for( unsigned i = 0; i < inLogic.Count(); i++ )
	{
		dgt_AlgLogic_Ptr tItem = inLogic.Item( i );
		m_Logics.Add( tItem );
	}

	RETURN_VOID( "dgt_Algorithm::set_Logics" );
}

/**********************************************************************************************/
unsigned dgt_Algorithm::get_LogicsCount( void )
{
	START( "DgtKernel", "dgt_Algorithm::get_LogicsCount" );

	unsigned result;

	result = m_Logics.Count();

	RETURN( "dgt_Algorithm::get_Name", result );
	return result;
}

/**********************************************************************************************/
dgt_AlgVarArray	dgt_Algorithm::get_InputVars( void )
{
	START( "DgtKernel", "dgt_Algorithm::get_InputVars" );

	dgt_AlgVarArray result;

	for( unsigned i = 0; i < m_InputVars.Count(); i++ )
		result.Add( m_InputVars.Item( i ) );

	RETURN( "dgt_Algorithm::get_Name", result );
	return result;
}

/**********************************************************************************************/
void dgt_Algorithm::set_InputVars( dgt_AlgVarArray inInputVars )
{
	START( "DgtKernel", "dgt_Algorithm::set_InputVars" );
	LOG_PARAM( inInputVars );

	for( unsigned i = 0; i < inInputVars.Count(); i++ )
	{
		dgt_AlgVar_Ptr tItem = inInputVars.Item( i );
		m_InputVars.Add( tItem );
	}

	RETURN_VOID( "dgt_Algorithm::set_InputVars" );
}

/**********************************************************************************************/
unsigned dgt_Algorithm::get_InputVarsCount( void )
{
	START( "DgtKernel", "dgt_Algorithm::get_InputVarsCount" );

	unsigned result;

	result = m_InputVars.Count();

	RETURN( "dgt_Algorithm::get_Name", result );
	return result;
}

/**********************************************************************************************/
dgt_AlgVarArray dgt_Algorithm::get_InternalVars( void )
{
	START( "DgtKernel", "dgt_Algorithm::get_InternalVars" );

	dgt_AlgVarArray result;

	for( unsigned i = 0; i < m_InternalVars.Count(); i++ )
		result.Add( m_InternalVars.Item( i ) );

	RETURN( "dgt_Algorithm::get_Name", result );
	return result;
}

/**********************************************************************************************/
void dgt_Algorithm::set_InternalVars( dgt_AlgVarArray inInternalVars )
{
	START( "DgtKernel", "dgt_Algorithm::set_InternalVars" );
	LOG_PARAM( inInternalVars );

	for( unsigned i = 0; i < inInternalVars.Count(); i++ )
	{
		dgt_AlgVar_Ptr tItem = inInternalVars.Item( i );
		m_InternalVars.Add( tItem );
	}

	RETURN_VOID( "dgt_Algorithm::set_InternalVars" );
}

/**********************************************************************************************/
unsigned dgt_Algorithm::get_InternalVarsCount( void )
{
	START( "DgtKernel", "dgt_Algorithm::get_InternalVarsCount" );

	unsigned result;

	result = m_InternalVars.Count();

	RETURN( "dgt_Algorithm::get_Name", result );
	return result;
}

/**********************************************************************************************/
dgt_AlgVarArray dgt_Algorithm::get_OutputVars( void )
{
	START( "DgtKernel", "dgt_Algorithm::get_OutputVars" );

	dgt_AlgVarArray result;

	for( unsigned i = 0; i < m_OutputVars.Count(); i++ )
		result.Add( m_OutputVars.Item( i ) );

	RETURN( "dgt_Algorithm::get_Name", result );
	return result;
}

/**********************************************************************************************/
void dgt_Algorithm::set_OutputVars( dgt_AlgVarArray inOutputVars )
{
	START( "DgtKernel", "dgt_Algorithm::set_OutputVars" );
	LOG_PARAM( inOutputVars );

	for( unsigned i = 0; i < inOutputVars.Count(); i++ )
	{
		dgt_AlgVar_Ptr tItem = inOutputVars.Item( i );
		m_OutputVars.Add( tItem );
	}
	
	RETURN_VOID( "dgt_Algorithm::set_OutputVars" );
}

/**********************************************************************************************/
unsigned dgt_Algorithm::get_OutputVarsCount( void )
{
	START( "DgtKernel", "dgt_Algorithm::get_OutputVarsCount" );

	unsigned result;

	result = m_OutputVars.Count();

	RETURN( "dgt_Algorithm::get_Name", result );
	return result;
}